<template>
	<view>
		<z-paging ref="paging" v-model="list" @query="getPage" :auto="false">
			<cu-custom slot="top" :bgColor="'bg-' + theme.themeColor" :isBack="true">
				<block slot="content">我的足迹</block>
			</cu-custom>
			<view class="cu-card article no-card">
				<view class="cu-item shadow solid-bottom padding-sm" v-for="(item, index) in list" :key="index">
					<navigator class="flex" hover-class="none"
						:url="'/pages/goods/goods-detail/index?id=' + item.goodsSpu.id">
						<view class="content">
							<image :src="item.goodsSpu.spuUrls[0]" mode="aspectFill"></image>
							<view class="desc">
								<view class="hx-overflow-2"> {{item.goodsSpu.name}}</view>
								<view>
									<text class="text-price"
										:class="'text-'+theme.themeColor">{{item.goodsSpu.highPrice != item.goodsSpu.lowPrice ? item.goodsSpu.lowPrice+"起": item.goodsSpu.highPrice}}</text>
									<view>已售{{item.goodsSpu.salesVolume}}</view>
								</view>
							</view>
						</view>
					</navigator>
				</view>
			</view>
		</z-paging>
	</view>

</template>

<script>
	import {
		getPage
	} from '@/api/userfootprint.js'
	export default {
		data() {
			return {
				theme: getApp().globalData.theme,
				list: [],
			};
		},
		onLoad() {
			getApp().initPage().then(res => {
				this.$nextTick(function() {
					this.$refs.paging.reload();
				})
			})
		},
		methods: {
			/**
			 * 分页查询
			 */
			getPage(pageNo, pageSize) {
				getPage({
					current: pageNo,
					size: pageSize,
					descs: 'create_time',
				}).then(res => {
					this.$refs.paging.complete(res.data.records);
				});
			}
		}
	}
</script>

<style>
</style>
